package org.event.core.controller;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangjm
 * @date 2023年11月28日 16:17
 */
@RestController
public class KafkaConsumerController {

    //监听消费
    @KafkaListener(topics = {"topic.test"})
    public void onNormalMessage(ConsumerRecord<String, Object> record) {
        System.out.println("简单消费：" + record.topic() + "-" + record.partition() + "=" +
                record.value());
    }
}
